package com.sy.controller.purchase;

import com.sy.bean.purchase.MaterialExcel;
import com.sy.bean.purchase.QueryMaterial;
import com.sy.common.bean.PageBean;
import com.sy.common.bean.ResultBean;
import com.sy.common.controller.BaseController;
import com.sy.common.utils.BeanOfMap;
import com.sy.service.purchase.MaterialService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@Api(tags = "purchase=供应商供货统计查询")
@RequestMapping("/api")
public class MaterialController extends BaseController {

    @Autowired
    MaterialService materialService;

    @ApiOperation("供应商供货统计查询")
    @PostMapping("/material")
    public ResultBean query(@RequestBody QueryMaterial material) {
        PageBean bean= materialService.query(BeanOfMap.bom(material));
        return success("查询成功",bean);
    }

    @ApiOperation("导出供应商供货统计表")
    @PostMapping("/export")
    public ResultBean<MaterialExcel> export(@RequestBody Map map) {
        String url= materialService.export(map);
        return success("导出供应商供货统计表",url);
    }
}
